NEW_USER_STAY_ANALYSIS_CONFIG = {
    'real_time_report': False,
    'group_by': '_chn.keyword',
    'interval_type_list': ['day'],
    'dynamic_argument': True,
    'day_to_calc': [0, 1, 2, 3, 4, 5, 6, 13, 29, 59],
    'target_event_id': ['active', 'register', 'bet_order'],
    'on_day_event_id': ['register', 'bet_order'],
    'values': [
        {
            "value_id": "device_stay_1",
            "target_value": "_aid.keyword",
            "value_name": "首日启动设备",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_device_active_days": 0}}
            ],
            "time_range": {
                "_event_time": [0, 0],
            },
            "operation": "cardinality"
        },
        {
            "value_id": "device_stay_2",
            "target_value": "_aid.keyword",
            "value_name": "次日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_device_active_days": 1}}
            ],
            "time_range": {
                "_event_time": [1, 1]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "device_stay_3",
            "target_value": "_aid.keyword",
            "value_name": "3日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_device_active_days": 2}}
            ],
            "time_range": {
                "_event_time": [2, 2]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "device_stay_4",
            "target_value": "_aid.keyword",
            "value_name": "4日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_device_active_days": 3}}
            ],
            "time_range": {
                "_event_time": [3, 3]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "device_stay_5",
            "target_value": "_aid.keyword",
            "value_name": "5日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_device_active_days": 4}}
            ],
            "time_range": {
                "_event_time": [4, 4]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "device_stay_6",
            "target_value": "_aid.keyword",
            "value_name": "6日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_device_active_days": 5}}
            ],
            "time_range": {
                "_event_time": [5, 5]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "device_stay_7",
            "target_value": "_aid.keyword",
            "value_name": "7日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_device_active_days": 6}}
            ],
            "time_range": {
                "_event_time": [6, 6]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "device_stay_15",
            "target_value": "_aid.keyword",
            "value_name": "15日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_device_active_days": 14}}
            ],
            "time_range": {
                "_event_time": [14, 14]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "device_stay_30",
            "target_value": "_aid.keyword",
            "value_name": "30日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_device_active_days": 29}}
            ],
            "time_range": {
                "_event_time": [29, 29]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "device_stay_60",
            "target_value": "_aid.keyword",
            "value_name": "60日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_device_active_days": 59}}
            ],
            "time_range": {
                "_event_time": [59, 59]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "device_stay_rate_2",
            "value_name": "次日留存率",
            "value_expr": "device_stay_2 / device_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "device_stay_rate_3",
            "value_name": "3日留存率",
            "value_expr": "device_stay_3 / device_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "device_stay_rate_4",
            "value_name": "4日留存率",
            "value_expr": "device_stay_4 / device_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "device_stay_rate_5",
            "value_name": "5日留存率",
            "value_expr": "device_stay_5 / device_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "device_stay_rate_6",
            "value_name": "6日留存率",
            "value_expr": "device_stay_6 / device_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "device_stay_rate_7",
            "value_name": "7日留存率",
            "value_expr": "device_stay_7 / device_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "device_stay_rate_15",
            "value_name": "15日留存率",
            "value_expr": "device_stay_15 / device_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "device_stay_rate_30",
            "value_name": "30日留存率",
            "value_expr": "device_stay_30 / device_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "device_stay_rate_60",
            "value_name": "60日留存率",
            "value_expr": "device_stay_30 / device_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "user_stay_1",
            "target_value": "_user_id",
            "value_name": "首日注册账号",
            "filter": [
                {"term": {"_event_id": "register"}}
            ],
            "time_range": {
                "_event_time": [0, 0]
            },
            "operation": "value_count"
        },
        {
            "value_id": "user_stay_2",
            "target_value": "_user_id",
            "value_name": "次日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_active_days": 1}}
            ],
            "time_range": {
                "_event_time": [1, 1]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "user_stay_3",
            "target_value": "_user_id",
            "value_name": "3日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_active_days": 2}}
            ],
            "time_range": {
                "_event_time": [2, 2]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "user_stay_4",
            "target_value": "_user_id",
            "value_name": "4日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_active_days": 3}}
            ],
            "time_range": {
                "_event_time": [3, 3]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "user_stay_5",
            "target_value": "_user_id",
            "value_name": "5日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_active_days": 4}}
            ],
            "time_range": {
                "_event_time": [4, 4]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "user_stay_6",
            "target_value": "_user_id",
            "value_name": "6日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_active_days": 5}}
            ],
            "time_range": {
                "_event_time": [5, 5]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "user_stay_7",
            "target_value": "_user_id",
            "value_name": "7日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_active_days": 6}}
            ],
            "time_range": {
                "_event_time": [6, 6]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "user_stay_15",
            "target_value": "_user_id",
            "value_name": "15日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_active_days": 14}}
            ],
            "time_range": {
                "_event_time": [14, 14]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "user_stay_30",
            "target_value": "_user_id",
            "value_name": "30日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_active_days": 29}}
            ],
            "time_range": {
                "_event_time": [29, 29]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "user_stay_60",
            "target_value": "_user_id",
            "value_name": "60日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"term": {"_active_days": 59}}
            ],
            "time_range": {
                "_event_time": [59, 59]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "user_stay_rate_2",
            "value_name": "次日留存率",
            "value_expr": "user_stay_2 / user_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "user_stay_rate_3",
            "value_name": "3日留存率",
            "value_expr": "user_stay_3 / user_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "user_stay_rate_4",
            "value_name": "4日留存率",
            "value_expr": "user_stay_4 / user_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "user_stay_rate_5",
            "value_name": "5日留存率",
            "value_expr": "user_stay_5 / user_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "user_stay_rate_6",
            "value_name": "6日留存率",
            "value_expr": "user_stay_6 / user_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "user_stay_rate_7",
            "value_name": "7日留存率",
            "value_expr": "user_stay_7 / user_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "user_stay_rate_15",
            "value_name": "15日留存率",
            "value_expr": "user_stay_15 / user_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "user_stay_rate_30",
            "value_name": "30日留存率",
            "value_expr": "user_stay_30 / user_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "user_stay_rate_60",
            "value_name": "60日留存率",
            "value_expr": "user_stay_60 / user_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "register_stay_1",
            "target_value": "_user_id",
            "value_name": "首日绑定账号",
            "filter": [
                {"terms": {"_user_id": "${register_user_1}"}}
            ],
            "time_range": {
                "_event_time": [0, 0]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "register_stay_2",
            "target_value": "_user_id",
            "value_name": "次日留存",
            "filter": [
                {"terms": {"_user_id": "${register_user_1}"}},
                {"term": {"_event_id": "active"}},
            ],
            "time_range": {
                "_event_time": [1, 1]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "register_stay_3",
            "target_value": "_user_id",
            "value_name": "3日留存",
            "filter": [
                {"terms": {"_user_id": "${register_user_1}"}},
                {"term": {"_event_id": "active"}},
            ],
            "time_range": {
                "_event_time": [2, 2]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "register_stay_4",
            "target_value": "_user_id",
            "value_name": "4日留存",
            "filter": [
                {"terms": {"_user_id": "${register_user_1}"}},
                {"term": {"_event_id": "active"}},
            ],
            "time_range": {
                "_event_time": [3, 3]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "register_stay_5",
            "target_value": "_user_id",
            "value_name": "5日留存",
            "filter": [
                {"terms": {"_user_id": "${register_user_1}"}},
                {"term": {"_event_id": "active"}},
            ],
            "time_range": {
                "_event_time": [4, 4]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "register_stay_6",
            "target_value": "_user_id",
            "value_name": "6日留存",
            "filter": [
                {"terms": {"_user_id": "${register_user_1}"}},
                {"term": {"_event_id": "active"}},
            ],
            "time_range": {
                "_event_time": [5, 5]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "register_stay_7",
            "target_value": "_user_id",
            "value_name": "7日留存",
            "filter": [
                {"terms": {"_user_id": "${register_user_1}"}},
                {"term": {"_event_id": "active"}},
            ],
            "time_range": {
                "_event_time": [6, 6]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "register_stay_15",
            "target_value": "_user_id",
            "value_name": "15日留存",
            "filter": [
                {"terms": {"_user_id": "${register_user_1}"}},
                {"term": {"_event_id": "active"}},
            ],
            "time_range": {
                "_event_time": [14, 14]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "register_stay_30",
            "target_value": "_user_id",
            "value_name": "30日留存",
            "filter": [
                {"terms": {"_user_id": "${register_user_1}"}},
                {"term": {"_event_id": "active"}},
            ],
            "time_range": {
                "_event_time": [29, 29]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "register_stay_60",
            "target_value": "_user_id",
            "value_name": "60日留存",
            "filter": [
                {"terms": {"_user_id": "${register_user_1}"}},
                {"term": {"_event_id": "active"}},
            ],
            "time_range": {
                "_event_time": [59, 59]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "register_stay_rate_2",
            "value_name": "次日留存率",
            "value_expr": "register_stay_2 / register_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "register_stay_rate_3",
            "value_name": "3日留存率",
            "value_expr": "register_stay_3 / register_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "register_stay_rate_4",
            "value_name": "4日留存率",
            "value_expr": "register_stay_4 / register_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "register_stay_rate_5",
            "value_name": "5日留存率",
            "value_expr": "register_stay_5 / register_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "register_stay_rate_6",
            "value_name": "6日留存率",
            "value_expr": "register_stay_6 / register_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "register_stay_rate_7",
            "value_name": "7日留存率",
            "value_expr": "register_stay_7 / register_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "register_stay_rate_15",
            "value_name": "15日留存率",
            "value_expr": "register_stay_15 / register_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "register_stay_rate_30",
            "value_name": "30日留存率",
            "value_expr": "register_stay_30 / register_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "register_stay_rate_60",
            "value_name": "60日留存率",
            "value_expr": "register_stay_60 / register_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "bet_stay_1",
            "target_value": "_user_id",
            "value_name": "首日投注账号",
            "filter": [
                {"terms": {"_user_id": "${bet_order_user_1}"}}
            ],
            "time_range": {
                "_event_time": [0, 0]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "bet_stay_2",
            "target_value": "_user_id",
            "value_name": "次日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${bet_order_user_1}"}}
            ],
            "time_range": {
                "_event_time": [1, 1]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "bet_stay_3",
            "target_value": "_user_id",
            "value_name": "3日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${bet_order_user_1}"}}
            ],
            "time_range": {
                "_event_time": [2, 2]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "bet_stay_4",
            "target_value": "_user_id",
            "value_name": "4日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${bet_order_user_1}"}}
            ],
            "time_range": {
                "_event_time": [3, 3]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "bet_stay_5",
            "target_value": "_user_id",
            "value_name": "5日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${bet_order_user_1}"}}
            ],
            "time_range": {
                "_event_time": [4, 4]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "bet_stay_6",
            "target_value": "_user_id",
            "value_name": "6日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${bet_order_user_1}"}}
            ],
            "time_range": {
                "_event_time": [5, 5]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "bet_stay_7",
            "target_value": "_user_id",
            "value_name": "7日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${bet_order_user_1}"}}
            ],
            "time_range": {
                "_event_time": [6, 6]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "bet_stay_15",
            "target_value": "_user_id",
            "value_name": "15日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${bet_order_user_1}"}}
            ],
            "time_range": {
                "_event_time": [14, 14]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "bet_stay_30",
            "target_value": "_user_id",
            "value_name": "30日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${bet_order_user_1}"}}
            ],
            "time_range": {
                "_event_time": [29, 29]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "bet_stay_60",
            "target_value": "_user_id",
            "value_name": "60日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${bet_order_user_1}"}}
            ],
            "time_range": {
                "_event_time": [59, 59]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "bet_stay_rate_2",
            "value_name": "次日留存率",
            "value_expr": "bet_stay_2 / bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "bet_stay_rate_3",
            "value_name": "3日留存率",
            "value_expr": "bet_stay_3 / bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "bet_stay_rate_4",
            "value_name": "4日留存率",
            "value_expr": "bet_stay_4 / bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "bet_stay_rate_5",
            "value_name": "5日留存率",
            "value_expr": "bet_stay_5 / bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "bet_stay_rate_6",
            "value_name": "6日留存率",
            "value_expr": "bet_stay_6 / bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "bet_stay_rate_7",
            "value_name": "7日留存率",
            "value_expr": "bet_stay_7 / bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "bet_stay_rate_15",
            "value_name": "15日留存率",
            "value_expr": "bet_stay_15 / bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "bet_stay_rate_30",
            "value_name": "30日留存率",
            "value_expr": "bet_stay_30 / bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "bet_stay_rate_60",
            "value_name": "60日留存率",
            "value_expr": "bet_stay_60 / bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "free_bet_stay_1",
            "target_value": "_user_id",
            "value_name": "首日无付费账号",
            "filter": [
                {"terms": {"_user_id": "${free_bet_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [0, 0]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "free_bet_stay_2",
            "target_value": "_user_id",
            "value_name": "次日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${free_bet_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [1, 1]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "free_bet_stay_3",
            "target_value": "_user_id",
            "value_name": "3日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${free_bet_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [2, 2]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "free_bet_stay_4",
            "target_value": "_user_id",
            "value_name": "4日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${free_bet_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [3, 3]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "free_bet_stay_5",
            "target_value": "_user_id",
            "value_name": "5日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${free_bet_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [4, 4]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "free_bet_stay_6",
            "target_value": "_user_id",
            "value_name": "6日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${free_bet_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [5, 5]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "free_bet_stay_7",
            "value_name": "7日留存",
            "target_value": "_user_id",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${free_bet_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [6, 6]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "free_bet_stay_15",
            "target_value": "_user_id",
            "value_name": "15日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${free_bet_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [14, 14]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "free_bet_stay_30",
            "target_value": "_user_id",
            "value_name": "30日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${free_bet_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [29, 29]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "free_bet_stay_60",
            "target_value": "_user_id",
            "value_name": "60日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${free_bet_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [59, 59]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "free_bet_stay_rate_2",
            "value_name": "次日留存率",
            "value_expr": "free_bet_stay_2 / free_bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "free_bet_stay_rate_3",
            "value_name": "3日留存率",
            "value_expr": "free_bet_stay_3 / free_bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "free_bet_stay_rate_4",
            "value_name": "4日留存率",
            "value_expr": "free_bet_stay_4 / free_bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "free_bet_stay_rate_5",
            "value_name": "5日留存率",
            "value_expr": "free_bet_stay_5 / free_bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "free_bet_stay_rate_6",
            "value_name": "6日留存率",
            "value_expr": "free_bet_stay_6 / free_bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "free_bet_stay_rate_7",
            "value_name": "7日留存率",
            "value_expr": "free_bet_stay_7 / free_bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "free_bet_stay_rate_15",
            "value_name": "15日留存率",
            "value_expr": "free_bet_stay_15 / free_bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "free_bet_stay_rate_30",
            "value_name": "30日留存率",
            "value_expr": "free_bet_stay_30 / free_bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "free_bet_stay_rate_60",
            "value_name": "60日留存率",
            "value_expr": "free_bet_stay_60 / free_bet_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "recharge_stay_1",
            "target_value": "_user_id",
            "value_name": "首日付费账号",
            "filter": [
                {"terms": {"_user_id": "${recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [0, 0]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "recharge_stay_2",
            "target_value": "_user_id",
            "value_name": "次日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [1, 1]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "recharge_stay_3",
            "target_value": "_user_id",
            "value_name": "3日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [2, 2]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "recharge_stay_4",
            "target_value": "_user_id",
            "value_name": "4日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [3, 3]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "recharge_stay_5",
            "target_value": "_user_id",
            "value_name": "5日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [4, 4]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "recharge_stay_6",
            "target_value": "_user_id",
            "value_name": "6日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [5, 5]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "recharge_stay_7",
            "target_value": "_user_id",
            "value_name": "7日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [6, 6]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "recharge_stay_15",
            "target_value": "_user_id",
            "value_name": "15日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [14, 14]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "recharge_stay_30",
            "target_value": "_user_id",
            "value_name": "30日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [29, 29]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "recharge_stay_60",
            "target_value": "_user_id",
            "value_name": "60日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [59, 59]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "recharge_stay_rate_2",
            "value_name": "次日留存率",
            "value_expr": "recharge_stay_2 / recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "recharge_stay_rate_3",
            "value_name": "3日留存率",
            "value_expr": "recharge_stay_3 / recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "recharge_stay_rate_4",
            "value_name": "4日留存率",
            "value_expr": "recharge_stay_4 / recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "recharge_stay_rate_5",
            "value_name": "5日留存率",
            "value_expr": "recharge_stay_5 / recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "recharge_stay_rate_6",
            "value_name": "6日留存率",
            "value_expr": "recharge_stay_6 / recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "recharge_stay_rate_7",
            "value_name": "7日留存率",
            "value_expr": "recharge_stay_7 / recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "recharge_stay_rate_15",
            "value_name": "15日留存率",
            "value_expr": "recharge_stay_15 / recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "recharge_stay_rate_30",
            "value_name": "30日留存率",
            "value_expr": "recharge_stay_30 / recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "recharge_stay_rate_60",
            "value_name": "60日留存率",
            "value_expr": "recharge_stay_60 / recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "one_recharge_stay_1",
            "target_value": "_user_id",
            "value_name": "首日一次付费账号",
            "filter": [
                {"terms": {"_user_id": "${one_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [0, 0]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "one_recharge_stay_2",
            "target_value": "_user_id",
            "value_name": "次日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${one_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [1, 1]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "one_recharge_stay_3",
            "target_value": "_user_id",
            "value_name": "3日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${one_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [2, 2]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "one_recharge_stay_4",
            "target_value": "_user_id",
            "value_name": "4日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${one_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [3, 3]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "one_recharge_stay_5",
            "target_value": "_user_id",
            "value_name": "5日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${one_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [4, 4]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "one_recharge_stay_6",
            "target_value": "_user_id",
            "value_name": "6日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${one_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [5, 5]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "one_recharge_stay_7",
            "target_value": "_user_id",
            "value_name": "7日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${one_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [6, 6]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "one_recharge_stay_15",
            "target_value": "_user_id",
            "value_name": "14日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${one_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [14, 14]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "one_recharge_stay_30",
            "target_value": "_user_id",
            "value_name": "30日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${one_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [29, 29]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "one_recharge_stay_60",
            "target_value": "_user_id",
            "value_name": "60日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${one_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [59, 59]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "one_recharge_stay_rate_2",
            "value_name": "次日留存率",
            "value_expr": "one_recharge_stay_2 / one_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "one_recharge_stay_rate_3",
            "value_name": "3日留存率",
            "value_expr": "one_recharge_stay_3 / one_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "one_recharge_stay_rate_4",
            "value_name": "4日留存率",
            "value_expr": "one_recharge_stay_4 / one_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "one_recharge_stay_rate_5",
            "value_name": "5日留存率",
            "value_expr": "one_recharge_stay_5 / one_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "one_recharge_stay_rate_6",
            "value_name": "6日留存率",
            "value_expr": "one_recharge_stay_6 / one_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "one_recharge_stay_rate_7",
            "value_name": "7日留存率",
            "value_expr": "one_recharge_stay_7 / one_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "one_recharge_stay_rate_15",
            "value_name": "15日留存率",
            "value_expr": "one_recharge_stay_15 / one_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "one_recharge_stay_rate_30",
            "value_name": "30日留存率",
            "value_expr": "one_recharge_stay_30 / one_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "one_recharge_stay_rate_60",
            "value_name": "60日留存率",
            "value_expr": "one_recharge_stay_60 / one_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "multi_recharge_stay_1",
            "target_value": "_user_id",
            "value_name": "首日多次付费账号",
            "filter": [
                {"terms": {"_user_id": "${multi_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [0, 0]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "multi_recharge_stay_2",
            "target_value": "_user_id",
            "value_name": "次日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${multi_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [1, 1]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "multi_recharge_stay_3",
            "target_value": "_user_id",
            "value_name": "3日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${multi_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [2, 2]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "multi_recharge_stay_4",
            "target_value": "_user_id",
            "value_name": "4日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${multi_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [3, 3]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "multi_recharge_stay_5",
            "target_value": "_user_id",
            "value_name": "5日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${multi_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [4, 4]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "multi_recharge_stay_6",
            "target_value": "_user_id",
            "value_name": "6日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${multi_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [5, 5]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "multi_recharge_stay_7",
            "target_value": "_user_id",
            "value_name": "7日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${multi_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [6, 6]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "multi_recharge_stay_15",
            "target_value": "_user_id",
            "value_name": "15日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${multi_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [14, 14]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "multi_recharge_stay_30",
            "target_value": "_user_id",
            "value_name": "30日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${multi_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [29, 29]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "multi_recharge_stay_60",
            "target_value": "_user_id",
            "value_name": "60日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${multi_recharge_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [59, 59]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "multi_recharge_stay_rate_2",
            "value_name": "次日留存率",
            "value_expr": "multi_recharge_stay_2 / multi_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "multi_recharge_stay_rate_3",
            "value_name": "3日留存率",
            "value_expr": "multi_recharge_stay_3 / multi_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "multi_recharge_stay_rate_4",
            "value_name": "4日留存率",
            "value_expr": "multi_recharge_stay_4 / multi_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "multi_recharge_stay_rate_5",
            "value_name": "5日留存率",
            "value_expr": "multi_recharge_stay_5 / multi_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "multi_recharge_stay_rate_6",
            "value_name": "6日留存率",
            "value_expr": "multi_recharge_stay_6 / multi_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "multi_recharge_stay_rate_7",
            "value_name": "7日留存率",
            "value_expr": "multi_recharge_stay_7 / multi_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "multi_recharge_stay_rate_15",
            "value_name": "15日留存率",
            "value_expr": "multi_recharge_stay_15 / multi_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "multi_recharge_stay_rate_30",
            "value_name": "30日留存率",
            "value_expr": "multi_recharge_stay_30 / multi_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "multi_recharge_stay_rate_60",
            "value_name": "60日留存率",
            "value_expr": "multi_recharge_stay_60 / multi_recharge_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "win_stay_1",
            "target_value": "_user_id",
            "value_name": "首日玩法盈利账号",
            "filter": [
                {"terms": {"_user_id": "${win_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [0, 0]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "win_stay_2",
            "target_value": "_user_id",
            "value_name": "次日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${win_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [1, 1]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "win_stay_3",
            "target_value": "_user_id",
            "value_name": "3日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${win_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [2, 2]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "win_stay_4",
            "target_value": "_user_id",
            "value_name": "4日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${win_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [3, 3]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "win_stay_5",
            "target_value": "_user_id",
            "value_name": "5日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${win_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [4, 4]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "win_stay_6",
            "target_value": "_user_id",
            "value_name": "6日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${win_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [5, 5]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "win_stay_7",
            "target_value": "_user_id",
            "value_name": "7日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${win_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [6, 6]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "win_stay_15",
            "target_value": "_user_id",
            "value_name": "15日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${win_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [14, 14]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "win_stay_30",
            "target_value": "_user_id",
            "value_name": "30日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${win_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [29, 29]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "win_stay_60",
            "target_value": "_user_id",
            "value_name": "60日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${win_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [59, 59]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "win_stay_rate_2",
            "value_name": "次日留存率",
            "value_expr": "win_stay_2 / win_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "win_stay_rate_3",
            "value_name": "3日留存率",
            "value_expr": "win_stay_3 / win_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "win_stay_rate_4",
            "value_name": "4日留存率",
            "value_expr": "win_stay_4 / win_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "win_stay_rate_5",
            "value_name": "5日留存率",
            "value_expr": "win_stay_5 / win_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "win_stay_rate_6",
            "value_name": "6日留存率",
            "value_expr": "win_stay_6 / win_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "win_stay_rate_7",
            "value_name": "7日留存率",
            "value_expr": "win_stay_7 / win_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "win_stay_rate_15",
            "value_name": "15日留存率",
            "value_expr": "win_stay_15 / win_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "win_stay_rate_30",
            "value_name": "30日留存率",
            "value_expr": "win_stay_30 / win_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "win_stay_rate_60",
            "value_name": "60日留存率",
            "value_expr": "win_stay_60 / win_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "lose_stay_1",
            "target_value": "_user_id",
            "value_name": "首日玩法亏损账号",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${lose_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [0, 0]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "lose_stay_2",
            "target_value": "_user_id",
            "value_name": "次日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${lose_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [1, 1]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "lose_stay_3",
            "target_value": "_user_id",
            "value_name": "3日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${lose_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [2, 2]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "lose_stay_4",
            "target_value": "_user_id",
            "value_name": "4日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${lose_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [3, 3]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "lose_stay_5",
            "target_value": "_user_id",
            "value_name": "5日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${lose_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [4, 4]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "lose_stay_6",
            "target_value": "_user_id",
            "value_name": "6日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${lose_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [5, 5]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "lose_stay_7",
            "target_value": "_user_id",
            "value_name": "7日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${lose_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [6, 6]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "lose_stay_15",
            "target_value": "_user_id",
            "value_name": "15日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${lose_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [14, 14]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "lose_stay_30",
            "target_value": "_user_id",
            "value_name": "30日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${lose_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [29, 29]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "lose_stay_60",
            "target_value": "_user_id",
            "value_name": "60日留存",
            "filter": [
                {"term": {"_event_id": "active"}},
                {"terms": {"_user_id": "${lose_stay_user_1}"}}
            ],
            "time_range": {
                "_event_time": [59, 59]
            },
            "operation": "cardinality"
        },
        {
            "value_id": "lose_stay_rate_2",
            "value_name": "次日留存率",
            "value_expr": "lose_stay_2 / lose_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "lose_stay_rate_3",
            "value_name": "3日留存率",
            "value_expr": "lose_stay_3 / lose_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "lose_stay_rate_4",
            "value_name": "4日留存率",
            "value_expr": "lose_stay_4 / lose_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "lose_stay_rate_5",
            "value_name": "5日留存率",
            "value_expr": "lose_stay_5 / lose_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "lose_stay_rate_6",
            "value_name": "6日留存率",
            "value_expr": "lose_stay_6 / lose_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "lose_stay_rate_7",
            "value_expr": "lose_stay_7 / lose_stay_1",
            "value_name": "7日留存率",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "lose_stay_rate_15",
            "value_name": "15日留存率",
            "value_expr": "lose_stay_15 / lose_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "lose_stay_rate_30",
            "value_name": "30日留存率",
            "value_expr": "lose_stay_30 / lose_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
        {
            "value_id": "lose_stay_rate_60",
            "value_name": "60日留存率",
            "value_expr": "lose_stay_60 / lose_stay_1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        }
    ]
}
